<?php

class usuariosModel extends Model 
{
    public function __construct() 
    {
        parent::__construct();
        $this->database = AbstractDatabase::GetDatabase('UsersDB');
    }
    
    public function Listar()
    {
        $posts = $this->database->Fetched_Query("Select * From Users");
        return $posts;
    }
    
    public function Agregar($Usuario, $Password,$Permiso)
    {   $Query = "Insert Into Users(Usuario, Password,Permiso) VALUES('".$Usuario."','".$Password."','".$Permiso."')";
        $this->database->Non_Fetched_Query($Query);
    }
    
    public function Modificar($Id,$Usuario, $Password,$Permiso)
    {
        $Query = "UPDATE Users SET Usuario = '".$Usuario."',Password = '".$Password."',Permiso ='".$Permiso."' WHERE IdUser = ".$Id;
        $this->database->Non_Fetched_Query($Query);     
    }
    
    public function Eliminar($Id)
    {
        $Query = "DELETE FROM USERS WHERE IdUser = $Id";
        $this->database->Non_Fetched_Query($Query);
    }
}

?>
